Skip to content

Conversation

manerlan
Copy link
Member

«Min side»: profile page with top 4, lists and reviews

Closes #73 .

Part 4 of the wine lists. /mine is now «Min side»: who you are, your top 4, the newest wines on each list, and your reviews. Each list and the reviews have their own page with «Last inn flere». /konto is still where you log in and out.

What's added

Fixed this #92 (comment) and updated .gitignore and removed unecessary .gitignore in /frontend.

Pages (all behind RequireAuth, so visitors are sent to log in and come back)

  • /mine – «Min side»: username and «Medlem siden …», «Topp 4», «Favoritter», «Vil prøve», «Har prøvd» (the 4 newest wines each, with «Se alle N …»), and «Mine dommer» (the 4 newest, with «Se alle N dommer»). Each part is a section with its own h2, so screen reader users can jump between them with the heading keys.
  • /mine/favoritter, /mine/vil-prove and /mine/har-provd: the whole list, 24 at a time with «Last inn flere». Focus moves to the first new wine. An unknown list gives «Fant ikke listen» with a link back.
  • /mine/dommer: all your reviews, 10 at a time, with «Nyeste først» or «Eldste først». The order is kept in the URL (?sortering=eldste), so reload and the back button keep it.
  • Empty states on every list and on the reviews, with a link to the search.

Top 4

  • Always shows 4 places, numbered, with «Ledig plass» for the empty ones.
  • «Endre topp 4» uses only buttons: «Legg til», «Flytt opp», «Flytt ned» and «Ta ut». There is no drag and drop, so it works the same with the keyboard, a screen reader and a mouse. Every change is announced, for example «Origem Merlot er flyttet til plass 2.», and focus stays on a sensible button.
  • When the top 4 is full, «Legg til» is aria-disabled (not disabled, so it keeps focus) and says why.
  • If a wine is no longer a favourite, for example after a change in another tab, the error says so instead of only «Prøv igjen».

Reviews

  • Each review shows «Gitt …» and «· endret …» when it has been changed. They are sorted by when they were given, so an edited review stays where it was.
  • Backend: User.reviews(order: NEWEST | OLDEST). The default is NEWEST, so existing queries work as before. See docs/api.md.

Cache and data

  • User.wines is cached per list, and User.reviews per order. «Min side» (4 wines) and the list pages (24 wines) share the cache, and the list pages fetch again (cache-and-network), so they always show the whole list.
  • When a wine is taken off a list, it disappears from «Min side», from the list page and from the top 4 at once. A message is announced, and focus moves to the heading if the button that had focus is gone.
  • After a review is saved or deleted, the user's reviews and lists are fetched again.
  • The wine page's back link knows where you came from: «Tilbake til Min side», «Tilbake til Mine dommer» or «Tilbake til listen».

Layout

  • Wines on «Min side» are shown in one row (1, 2 or 4 columns), not 3 + 1.
  • In narrow cards, the picture is on top (poster layout).
  • The list buttons on the cards are 44 × 40 px, close together, with more room from the edge.

Fixes after the review of #72

  • One change at a time per button: the check for a change on its way is shared for each wine and list, not per button. Two buttons for the same wine (a card and the wine page) can no longer send two changes at once.
  • The list rules exist twice (in backend/src/lists/wine-lists.ts and frontend/src/lib/wineLists.ts). Each now has a comment pointing to the other, so they are changed together.
  • The VM must update the backend before the frontend. This is in docs/vm.md (separate PR) and under «After merge» below.

Commits

  • chore: stop tracking Playwright's test-results (Profile page #73)
  • chore: one .gitignore at the root, and stop tracking test-results (Profile page #73)
  • fix(frontend): one list change at a time per wine across buttons, and notes from the review of Wine lists in the interface #72 (Profile page #73)
  • feat(frontend): «Min side» with the top 4 and each list, and a page for each list (Profile page #73)
  • feat: «Mine dommer» on «Min side», and /mine/dommer with newest or oldest first (Profile page #73)
  • feat(frontend): choose the top 4 with buttons that work with the keyboard and a screen reader (Profile page #73)
  • test(e2e): log in, add favourites, choose the top 4, see «Min side» and log out (Profile page #73)
  • fix(frontend): back link from «Min side», focus after more favourites, and clearer messages (Profile page #73)
  • test: count the requests sent in the one-change-at-a-time test, so it does not depend on timing (Profile page #73)
  • test: hold back the API answer when the list page is seen before it, so the test does not depend on timing (Profile page #73)
  • docs: «Min side», the top 4 editor, reviews in order, and manual tests for them (Profile page #73)

Tests

  • Unit and components: «Min side», the list pages, the reviews page with order in the URL, the top 4 and the editor (adding, moving, removing, a full top 4, saving, errors and announcements), the rules for the top 4, the review dates, the back links, and axe on every page.
  • API (database tests): User.reviews with OLDEST and paging, NEWEST as the default, and an error for an unknown order.
  • E2E (e2e/profile.spec.ts, desktop and mobile): log in, add a favourite, choose the top 4 with the keyboard, see «Min side», log out. Also: a wine taken off the favourites leaves the top 4. axe on every step. The fake API is now shared between the e2e tests (e2e/support/).
  • A flaky test in useWineList.test.tsx now counts the requests sent instead of waiting for the answer, so it no longer depends on how fast the computer is.

npm run check passes in frontend/, and npm test passes with TEST_DATABASE_URL in backend/. Test counts are in the README.

Manual testing

Followed section 9 in docs/manual-testing.md:

  • Functions (the table in 9.1)
  • Keyboard only, including «Endre topp 4»
  • Screen reader: not tested yet.

How to review

  1. Start the backend and run npm run db:migrate and npm run db:seed:demo. Then start the frontend.
  2. Log in as the demo user, and go to «Min side» in the header.
  3. Add and remove some favourites from the search, and see that «Min side» and the list pages follow.
  4. Click «Endre topp 4», and use only the keyboard: Tab, Enter and Space.
  5. Give a review, change it, and look at /mine/dommer with both orders.

After merge (VM)

The frontend asks for order on User.reviews, which the old backend does not know. Update the backend first, as in docs/vm.md: pull, npm ci, npm run db:migrate, restart the backend, and check with curl. Then run npm run buildvm for the frontend.

Not in this PR

  • Other sorting and filtering on the lists and reviews.
  • A new look for the top 4 (can be a later issue).
  • Known limits, also in docs/api.md:
    • After a wine is removed, the preview on «Min side» shows one wine fewer until the page is loaded again.
    • «Min side» is not updated from other tabs.
    • Unsaved changes in «Endre topp 4» are lost if you leave the page.
    • «Min side» makes about 10 small database queries.

@manerlan manerlan requested a review from a team as a code owner November 19, 2026 21:30
@manerlan manerlan linked an issue Nov 19, 2026 that may be closed by this pull request
6 tasks
Copy link
Member

@williasc williasc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. I ran npm run check (all pass) and the profile and lists e2e tests (14 passed), and it merges cleanly with main. I also clicked through with the demo user: «Min side», the top 4 editor (move, a full top 4, save), taking a top 4 wine off the favourites, the list page, the reviews page with oldest first, and the back link from a wine. All worked, with no console errors.

Enormous PR tho. Mby split them up next time:)

@williasc williasc merged commit 7d3882f into main Nov 20, 2026
@williasc williasc deleted the 73-profile-page branch November 20, 2026 13:45
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Profile page
2 participants